#include<stdio.h>
#include<stdlib.h>
#define true 1
#define false 0
#define error 0
#define ok 1
#define  maxsize 1200

typedef  int Elemtype;
typedef  int statue;

typedef  struct 
{
    Elemtype date[maxsize];
    int length;
}q_list;


statue initial_list(q_list **L)  //线性表的初始化
{
    (*L)=(q_list *)malloc(sizeof(q_list));
    if(!(*L)) exit(-2);
    (*L)->length=0;
    return ok;
}

statue creatlist(q_list *L,int n)
{
   int i=0;
   for(i;i<n;i++)
   {
      L->date[i]=i;
      L->length++;
   }
    return ok;
}

void destroylist(q_list *L)
{
free(L);
}

statue listempty(q_list *L)
{
    if  (L->length==0)
        return false;
    return true;
}

int lenthlist(q_list *L)
{
    return (L->length);
}

statue listget(q_list *L,int i,Elemtype e)
{

    if(i<0||i>L->length)
        return error;

    e=L->date[i-1];
    return true;
}

statue insertlist(q_list *L,int i,Elemtype t)
{
    int j;
    if(i<0||i>L->length)
        return false;

    for(j=i;j<L->length;j++)
        L->date[j]=L->date[j-1];

    L->date[i-1]=t;
    L->length++;
    return true;
}

statue listdele(q_list *L, int i,int e)
{
    int j;
    if(i<0||i>L->length)
        return false;

    for(j=i;j<L->length;j++)
        L->date[j-1]=L->date[j];

    e=L->date[i--]; 
    L->length--;
    return true;
}

void print(q_list *L)
{

    for(int i=0;i<L->length;i++) 
    {
        printf("%d",L->date[i]);
    }
    printf("\n");
}


int main()
{
    int num,insert,elem;
    q_list *L;
    // L = &a  L1 = &a   L = &b  指针 指针变量     地址
    scanf("%d",&num);
    scanf("%d",&insert);
    initial_list(&L);  // L 传一个地址   a  initial_list(L1)   initial_list(L)
    creatlist(L,num);
    print(L);
    insertlist(L,2,insert);
    print(L);
    printf("\n");
    listdele(L,5,&elem);
    destroylist(L);
    return 0;
}